<template>
  <p v-html="html"></p>
</template>

<script>
export default {
  name: 'LineBreaks',
  
  props: {
    text: String
  },
  
  computed: {
    html () {
      const _ = this.$_
      const lines = _.transform(_.split(this.text, /\r?\n/), (results, line) => {
        results.push(_.escape(line))
      }, [])

      return _.join(lines, '<br/>')
    }
  }
}

</script>
